<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class Info extends CI_Controller
{
    public function __construct()
    {
        parent::__construct();
    }


    public function index($id)
    {
        $this->load->model("Article_Type_Model");
        $this->load->model("Article_Model");
        $data = array();
        $this->Article_Model->id = $id;
        $data['navs'] = $this->Article_Type_Model->listParents();
        $data['domain'] = $this->Article_Model->load();
        $this->Article_Type_Model->id = $data['domain']->type_id;
        $data['subNavs'] = $this->Article_Type_Model->loadByPid($this->Article_Type_Model->load()->pid == 0 ? 0 : $this->Article_Type_Model->load()->pid);
        $this->load->vars($data);
        $this->load->view('info');
    }

    public function more($id)
    {
        $this->load->model("Article_Type_Model");
        $this->load->model("Article_Model");
        $data = array();
        $this->Article_Model->pid = $id;
        $data['navs'] = $this->Article_Type_Model->listParents();

        $this->Article_Type_Model->id = $id;
        $data['articleTypeName'] = $this->Article_Type_Model->load()->name;
        $data['subNavs'] = $this->Article_Type_Model->loadByPid($this->Article_Type_Model->load()->pid == 0 ? $id : $this->Article_Type_Model->load()->pid);
        $uri = $this->uri->segment_array();
        $cp = isset($uri[4]) ? $uri[4] : 0;
        $this->load->library('pagination');
        $this->pagination->initialize(array("uri_segment" => 4, "total_rows" => $this->Article_Model->paginationCount($id), "per_page" => 10, "base_url" => "/index.php/info/more/" . $id, "cur_page" => $cp));
        $data['pagination'] = $this->pagination;
        $data['articles'] = $this->Article_Model->pagination($id, 10, $cp);
        $this->load->vars($data);
        $this->load->view('list');
    }
}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */